import request from '@/utils/request'


export default {
    /**
     *  分页+条件查询 讲师列表
     * 
     * @param {*} currentPage   当前页码
     * @param {*} szie          显示条数
     * @param {*} teacherQuery  查询条件
     */
    getTeacherListPage(currentPage,size,teacherQuery){
        return request({
            // 写法一：url: '/eduservice/teacher/page/teacher/condition/'+currentPage+'/'+szie,
            url: `/eduservice/teacher/page/teacher/condition/${currentPage}/${size}`, //写法二：
            method: 'post',
            // teacherQuery查询条件对象。 后台使用RequestBody接收数据
            // data：作用将 数据转换为 json字符串传递到后台
            data:teacherQuery
          })
    },

    /**
     *  根据id 删除讲师
     * 
     * @param {*} id 讲师id
     */
    deleteTeacherById(id){
        return request({
            url:`/eduservice/teacher/${id}`,
            method:"delete"
        })
    },
    /**
     * 
     * 添加讲师
     * 
     * @param {讲师} teacher 
     */
    addTeacher(teacher){
        
        return request({
            url:"/eduservice/teacher/add/teacher",
            method:"post",
            data:teacher
        })
    },
    /**
     *  通过讲师 id 查询讲师信息
     * 
     * @param {讲师id} id 
     */
    getTeacherByid(id){
        return request({
            url:`/eduservice/teacher/get/teacher/${id}`,
            method:'get'
        })
    },
    /**
     * 
     * @param {讲师信息} teacher  修改讲师信息
     */
    editTeacher(teacher){
        return request({
            url:`/eduservice/teacher/update/teacher`,
            method:'post',
            data:teacher
        })
    }

}
